/*
 * FCKeditor - The text editor for internet
 * Copyright (C) 2003 Frederico Caldeira Knabben
 *
 * Licensed under the terms of the GNU Lesser General Public License
 * (http://www.opensource.org/licenses/lgpl-license.php)
 *
 * For further information go to http://www.fredck.com/FCKeditor/ 
 * or contact fckeditor@fredck.com.
 *
 * fckeditor.js: Inserts a FCKeditor instance in a HTML page.
 *
 * Authors:
 *   Frederico Caldeira Knabben (fckeditor@fredck.com)
 */

var FCKeditorBasePath = '/FCKeditor/' ;

// Check if the browser is compatible with the Editor:
//		- Internet Explorer 5 or above
var isCompatible = (navigator.appName == 'Microsoft Internet Explorer') ;
if (isCompatible)
{
	var browserVersion = navigator.appVersion.match(/MSIE (.)/)[1] ;
	isCompatible = (browserVersion >= 5) ;
}

function CreateFCKEditor(name, width, height, value, toolbarSet)
{

	if (isCompatible)
	{
		var sLink = FCKeditorBasePath + 'fckeditor.html?FieldName=' + name ;
		if (toolbarSet)
			sLink += '&Toolbar=' + toolbarSet ;
		document.write('<IFRAME src="' + sLink + '" width="' + width + '" height="' + height + '" frameborder="no" scrolling="no"></IFRAME>') ;
		document.write('<INPUT type="hidden" name="' + name + '" value="' + value + '">') ;
	}
	else
	{
		var sWidth  = width.toString().indexOf('%')  > 0 ? width  : width  + 'px' ;
		var sHeight = height.toString().indexOf('%') > 0 ? height : height + 'px' ;
		document.write('<TEXTAREA name="' + name + '" rows="5" cols="40"></TEXTAREA>') ;
	}
}